//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.restaurant.application.indexes.goodscouponlist.mysql;

import com.google.common.base.Strings;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import com.nebutown.base.Unit;
import com.nebutown.description.data.SortSpec;
import com.nebutown.generation.basictype.UID;
import com.nebutown.supporthome.AbstractIndex;
import java.sql.ResultSet;
import java.util.List;
import java.util.Map;

public class GoodsCouponListImpl extends AbstractIndex<GoodsCouponListCriteria, GoodsCouponListBean> {
    public GoodsCouponListImpl() {
    }

    public String getTableName() {
        return "" + this.getConnectionName() + ".GOODSCOUPONLIST";
    }

    public GoodsCouponListBean newBean() {
        return new GoodsCouponListBean();
    }

    public GoodsCouponListCriteria newCriteria() {
        return new GoodsCouponListCriteria();
    }

    public List<String> getFieldNames() {
        return Lists.newArrayList(new String[]{"GoodsCoupon", "goodsUID", "name", "goodsId", "couponNumber", "createTime", "firstCustomerId", "firstPhone", "useful", "state", "usedTime", "usedCustomerId", "usedPhone", "cashierName", "deliveryState", "type", "orderNumber", "address", "logistical", "currentCustomerId", "currentPhone", "currentName", "currentCustomerUid"});
    }

    public List<String> getDateFields() {
        return Lists.newArrayList(new String[]{"createTime", "usedTime"});
    }

    public List<String> getDoubleFields() {
        return Lists.newArrayList(new String[]{""});
    }

    public Map<String, String> getFieldLabels() {
        ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
        return builder.put("goodsUID", "商品UID").put("name", "商品名").put("goodsId", "商品Id").put("couponNumber", "券号").put("createTime", "领用时间").put("firstCustomerId", "领用人Id").put("firstPhone", "领用人手机").put("useful", "是否有效").put("state", "是否使用").put("usedTime", "使用日期").put("usedCustomerId", "使用人Id").put("usedPhone", "使用人手机").put("cashierName", "核销人").put("deliveryState", "发货状态").put("type", "类型").put("orderNumber", "订单编号").put("address", "配送地址").put("logistical", "物流编号").put("currentCustomerId", "当前人Id").put("currentPhone", "当前人手机").put("currentName", "当前人名").put("currentCustomerUid", "当前人uid").build();
    }

    public List<String> getContributors() {
        return Lists.newArrayList(new String[]{"com.restaurant.application.goodscoupon.GoodsCoupon"});
    }

    public GoodsCouponListBean fakeBean() {
        GoodsCouponListBean bean = new GoodsCouponListBean();
        bean.setGoodsCoupon(UID.recover("A 507453928598802347 looooong string"));
        bean.setGoodsUID("A 7997751097237634354 looooong string");
        bean.setName("A -1119312553199035507 looooong string");
        bean.setGoodsId("A 6582799304126483492 looooong string");
        bean.setCouponNumber("A -7181758494842043363 looooong string");
        bean.setCreateTime(-1169169478L);
        bean.setFirstCustomerId("A -1888259270897889206 looooong string");
        bean.setFirstPhone("A 5157189466684140432 looooong string");
        bean.setUseful("A 1079861651459407265 looooong string");
        bean.setState("A -3398462237769228093 looooong string");
        bean.setUsedTime(-47907881L);
        bean.setUsedCustomerId("A 3805791118421148075 looooong string");
        bean.setUsedPhone("A -3187399330809762440 looooong string");
        bean.setCashierName("A 3661626396727026819 looooong string");
        bean.setDeliveryState("A -8298724408198799116 looooong string");
        bean.setType("A -3913565989909104507 looooong string");
        bean.setOrderNumber("A -3575730520714132469 looooong string");
        bean.setAddress("A -1141326361386077963 looooong string");
        bean.setLogistical("A 3959939613857797304 looooong string");
        bean.setCurrentCustomerId("A 2101226192781679728 looooong string");
        bean.setCurrentPhone("A -1547541999382430554 looooong string");
        bean.setCurrentName("A 6405401918987427496 looooong string");
        bean.setCurrentCustomerUid("A 3648338529848231754 looooong string");
        return bean;
    }

    public String getCreateTableStatement() {
        StringBuilder buf = new StringBuilder();
        buf.append("CREATE TABLE IF NOT EXISTS " + this.getConnectionName() + ".GOODSCOUPONLIST (\n");
        buf.append("    RECORD_ID BIGINT AUTO_INCREMENT,\n");
        buf.append("    GOODSCOUPON CHAR(128) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL,\n");
        buf.append("    GOODSUID VARCHAR(255),\n");
        buf.append("    NAME VARCHAR(255),\n");
        buf.append("    GOODSID VARCHAR(255),\n");
        buf.append("    COUPONNUMBER VARCHAR(255),\n");
        buf.append("    CREATETIME BIGINT,\n");
        buf.append("    FIRSTCUSTOMERID VARCHAR(255),\n");
        buf.append("    FIRSTPHONE VARCHAR(255),\n");
        buf.append("    USEFUL VARCHAR(255),\n");
        buf.append("    STATE VARCHAR(255),\n");
        buf.append("    USEDTIME BIGINT,\n");
        buf.append("    USEDCUSTOMERID VARCHAR(255),\n");
        buf.append("    USEDPHONE VARCHAR(255),\n");
        buf.append("    CASHIERNAME VARCHAR(255),\n");
        buf.append("    DELIVERYSTATE VARCHAR(255),\n");
        buf.append("    TYPE VARCHAR(255),\n");
        buf.append("    ORDERNUMBER VARCHAR(255),\n");
        buf.append("    ADDRESS VARCHAR(255),\n");
        buf.append("    LOGISTICAL VARCHAR(255),\n");
        buf.append("    CURRENTCUSTOMERID VARCHAR(255),\n");
        buf.append("    CURRENTPHONE VARCHAR(255),\n");
        buf.append("    CURRENTNAME VARCHAR(255),\n");
        buf.append("    CURRENTCUSTOMERUID VARCHAR(255),\n");
        buf.append("PRIMARY KEY (RECORD_ID)) CHARACTER SET  = utf8mb4 COLLATE = utf8mb4_bin");
        return buf.toString();
    }

    public String getInsertDataStatement(GoodsCouponListBean data) {
        StringBuilder buf = new StringBuilder();
        buf.append("INSERT INTO " + this.getConnectionName() + ".GOODSCOUPONLIST (\n    ");
        buf.append("    GOODSCOUPON, GOODSUID, NAME, GOODSID, COUPONNUMBER, CREATETIME, FIRSTCUSTOMERID, FIRSTPHONE, USEFUL, STATE, USEDTIME, USEDCUSTOMERID, USEDPHONE, CASHIERNAME, DELIVERYSTATE, TYPE, ORDERNUMBER, ADDRESS, LOGISTICAL, CURRENTCUSTOMERID, CURRENTPHONE, CURRENTNAME, CURRENTCUSTOMERUID");
        buf.append(") VALUES (");
        buf.append("    '" + this.cut(data.getGoodsCoupon(), 128) + "', '" + this.cut(data.getGoodsUID(), 255) + "', '" + this.cut(data.getName(), 255) + "', '" + this.cut(data.getGoodsId(), 255) + "', '" + this.cut(data.getCouponNumber(), 255) + "', " + data.getCreateTime() + ", '" + this.cut(data.getFirstCustomerId(), 255) + "', '" + this.cut(data.getFirstPhone(), 255) + "', '" + this.cut(data.getUseful(), 255) + "', '" + this.cut(data.getState(), 255) + "', " + data.getUsedTime() + ", '" + this.cut(data.getUsedCustomerId(), 255) + "', '" + this.cut(data.getUsedPhone(), 255) + "', '" + this.cut(data.getCashierName(), 255) + "', '" + this.cut(data.getDeliveryState(), 255) + "', '" + this.cut(data.getType(), 255) + "', '" + this.cut(data.getOrderNumber(), 255) + "', '" + this.cut(data.getAddress(), 255) + "', '" + this.cut(data.getLogistical(), 255) + "', '" + this.cut(data.getCurrentCustomerId(), 255) + "', '" + this.cut(data.getCurrentPhone(), 255) + "', '" + this.cut(data.getCurrentName(), 255) + "', '" + this.cut(data.getCurrentCustomerUid(), 255) + "'");
        buf.append(")");
        return buf.toString();
    }

    public String getDeleteRowsStatement(Long rowId) {
        return "DELETE FROM " + this.getConnectionName() + ".GOODSCOUPONLIST WHERE  RECORD_ID = " + rowId;
    }

    public String getLocalUpdateStatement(GoodsCouponListBean data) {
        StringBuilder buf = new StringBuilder();
        StringBuilder sep = new StringBuilder();
        boolean hasData = false;
        buf.append("UPDATE " + this.getConnectionName() + ".GOODSCOUPONLIST \n");
        buf.append("   SET ");
        if (data.getGoodsCoupon() != null) {
            buf.append(sep.toString() + "\n      GOODSCOUPON = '" + this.cut(data.getGoodsCoupon(), 128) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getGoodsUID() != null) {
            buf.append(sep.toString() + "\n      GOODSUID = '" + this.cut(data.getGoodsUID(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getName() != null) {
            buf.append(sep.toString() + "\n      NAME = '" + this.cut(data.getName(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getGoodsId() != null) {
            buf.append(sep.toString() + "\n      GOODSID = '" + this.cut(data.getGoodsId(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getCouponNumber() != null) {
            buf.append(sep.toString() + "\n      COUPONNUMBER = '" + this.cut(data.getCouponNumber(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getCreateTime() != null) {
            buf.append(sep.toString() + "\n      CREATETIME = " + data.getCreateTime() + "");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getFirstCustomerId() != null) {
            buf.append(sep.toString() + "\n      FIRSTCUSTOMERID = '" + this.cut(data.getFirstCustomerId(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getFirstPhone() != null) {
            buf.append(sep.toString() + "\n      FIRSTPHONE = '" + this.cut(data.getFirstPhone(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getUseful() != null) {
            buf.append(sep.toString() + "\n      USEFUL = '" + this.cut(data.getUseful(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getState() != null) {
            buf.append(sep.toString() + "\n      STATE = '" + this.cut(data.getState(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getUsedTime() != null) {
            buf.append(sep.toString() + "\n      USEDTIME = " + data.getUsedTime() + "");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getUsedCustomerId() != null) {
            buf.append(sep.toString() + "\n      USEDCUSTOMERID = '" + this.cut(data.getUsedCustomerId(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getUsedPhone() != null) {
            buf.append(sep.toString() + "\n      USEDPHONE = '" + this.cut(data.getUsedPhone(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getCashierName() != null) {
            buf.append(sep.toString() + "\n      CASHIERNAME = '" + this.cut(data.getCashierName(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getDeliveryState() != null) {
            buf.append(sep.toString() + "\n      DELIVERYSTATE = '" + this.cut(data.getDeliveryState(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getType() != null) {
            buf.append(sep.toString() + "\n      TYPE = '" + this.cut(data.getType(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getOrderNumber() != null) {
            buf.append(sep.toString() + "\n      ORDERNUMBER = '" + this.cut(data.getOrderNumber(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getAddress() != null) {
            buf.append(sep.toString() + "\n      ADDRESS = '" + this.cut(data.getAddress(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getLogistical() != null) {
            buf.append(sep.toString() + "\n      LOGISTICAL = '" + this.cut(data.getLogistical(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getCurrentCustomerId() != null) {
            buf.append(sep.toString() + "\n      CURRENTCUSTOMERID = '" + this.cut(data.getCurrentCustomerId(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getCurrentPhone() != null) {
            buf.append(sep.toString() + "\n      CURRENTPHONE = '" + this.cut(data.getCurrentPhone(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getCurrentName() != null) {
            buf.append(sep.toString() + "\n      CURRENTNAME = '" + this.cut(data.getCurrentName(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getCurrentCustomerUid() != null) {
            buf.append(sep.toString() + "\n      CURRENTCUSTOMERUID = '" + this.cut(data.getCurrentCustomerUid(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (!hasData) {
            return "";
        } else {
            hasData = false;
            buf.append(" WHERE TRUE\n");
            if (data.getGoodsCoupon() != null) {
                buf.append("    AND GOODSCOUPON = '" + data.getGoodsCoupon() + "'\n");
                hasData = true;
            }

            return !hasData ? "" : buf.toString();
        }
    }

    public String getUpdateByIdStatement(GoodsCouponListBean data) {
        StringBuilder buf = new StringBuilder();
        StringBuilder sep = new StringBuilder();
        boolean hasData = false;
        buf.append("UPDATE " + this.getConnectionName() + ".GOODSCOUPONLIST \n");
        buf.append("   SET ");
        if (data.getGoodsCoupon() != null) {
            buf.append(sep.toString() + "\n      GOODSCOUPON = '" + this.cut(data.getGoodsCoupon(), 128) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getGoodsUID() != null) {
            buf.append(sep.toString() + "\n      GOODSUID = '" + this.cut(data.getGoodsUID(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getName() != null) {
            buf.append(sep.toString() + "\n      NAME = '" + this.cut(data.getName(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getGoodsId() != null) {
            buf.append(sep.toString() + "\n      GOODSID = '" + this.cut(data.getGoodsId(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getCouponNumber() != null) {
            buf.append(sep.toString() + "\n      COUPONNUMBER = '" + this.cut(data.getCouponNumber(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getCreateTime() != null) {
            buf.append(sep.toString() + "\n      CREATETIME = " + data.getCreateTime() + "");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getFirstCustomerId() != null) {
            buf.append(sep.toString() + "\n      FIRSTCUSTOMERID = '" + this.cut(data.getFirstCustomerId(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getFirstPhone() != null) {
            buf.append(sep.toString() + "\n      FIRSTPHONE = '" + this.cut(data.getFirstPhone(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getUseful() != null) {
            buf.append(sep.toString() + "\n      USEFUL = '" + this.cut(data.getUseful(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getState() != null) {
            buf.append(sep.toString() + "\n      STATE = '" + this.cut(data.getState(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getUsedTime() != null) {
            buf.append(sep.toString() + "\n      USEDTIME = " + data.getUsedTime() + "");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getUsedCustomerId() != null) {
            buf.append(sep.toString() + "\n      USEDCUSTOMERID = '" + this.cut(data.getUsedCustomerId(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getUsedPhone() != null) {
            buf.append(sep.toString() + "\n      USEDPHONE = '" + this.cut(data.getUsedPhone(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getCashierName() != null) {
            buf.append(sep.toString() + "\n      CASHIERNAME = '" + this.cut(data.getCashierName(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getDeliveryState() != null) {
            buf.append(sep.toString() + "\n      DELIVERYSTATE = '" + this.cut(data.getDeliveryState(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getType() != null) {
            buf.append(sep.toString() + "\n      TYPE = '" + this.cut(data.getType(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getOrderNumber() != null) {
            buf.append(sep.toString() + "\n      ORDERNUMBER = '" + this.cut(data.getOrderNumber(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getAddress() != null) {
            buf.append(sep.toString() + "\n      ADDRESS = '" + this.cut(data.getAddress(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getLogistical() != null) {
            buf.append(sep.toString() + "\n      LOGISTICAL = '" + this.cut(data.getLogistical(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getCurrentCustomerId() != null) {
            buf.append(sep.toString() + "\n      CURRENTCUSTOMERID = '" + this.cut(data.getCurrentCustomerId(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getCurrentPhone() != null) {
            buf.append(sep.toString() + "\n      CURRENTPHONE = '" + this.cut(data.getCurrentPhone(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getCurrentName() != null) {
            buf.append(sep.toString() + "\n      CURRENTNAME = '" + this.cut(data.getCurrentName(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (data.getCurrentCustomerUid() != null) {
            buf.append(sep.toString() + "\n      CURRENTCUSTOMERUID = '" + this.cut(data.getCurrentCustomerUid(), 255) + "'");
            hasData = true;
            sep.setLength(0);
            sep.append(",");
        }

        if (!hasData) {
            return "";
        } else {
            hasData = false;
            buf.append(" WHERE RECORD_ID = " + data.getRecordId());
            return buf.toString();
        }
    }

    public GoodsCouponListBean extractLine(ResultSet resultSet) throws Exception {
        GoodsCouponListBean result = new GoodsCouponListBean();
        result.setRecordId(resultSet.getLong("RECORD_ID"));
        result.setGoodsCoupon(UID.recover(resultSet.getString("GoodsCoupon")));
        result.setGoodsUID(resultSet.getString("goodsUID"));
        result.setName(resultSet.getString("name"));
        result.setGoodsId(resultSet.getString("goodsId"));
        result.setCouponNumber(resultSet.getString("couponNumber"));
        result.setCreateTime(resultSet.getLong("createTime"));
        result.setFirstCustomerId(resultSet.getString("firstCustomerId"));
        result.setFirstPhone(resultSet.getString("firstPhone"));
        result.setUseful(resultSet.getString("useful"));
        result.setState(resultSet.getString("state"));
        result.setUsedTime(resultSet.getLong("usedTime"));
        result.setUsedCustomerId(resultSet.getString("usedCustomerId"));
        result.setUsedPhone(resultSet.getString("usedPhone"));
        result.setCashierName(resultSet.getString("cashierName"));
        result.setDeliveryState(resultSet.getString("deliveryState"));
        result.setType(resultSet.getString("type"));
        result.setOrderNumber(resultSet.getString("orderNumber"));
        result.setAddress(resultSet.getString("address"));
        result.setLogistical(resultSet.getString("logistical"));
        result.setCurrentCustomerId(resultSet.getString("currentCustomerId"));
        result.setCurrentPhone(resultSet.getString("currentPhone"));
        result.setCurrentName(resultSet.getString("currentName"));
        result.setCurrentCustomerUid(resultSet.getString("currentCustomerUid"));
        return result;
    }

    public String getWherePart(GoodsCouponListCriteria criteria, SortSpec sort) {
        StringBuilder buf = new StringBuilder(" TRUE ");
        criteria.setGoodsUIDLike(this.searchString(criteria.getGoodsUIDLike()));
        criteria.setNameLike(this.searchString(criteria.getNameLike()));
        criteria.setGoodsIdLike(this.searchString(criteria.getGoodsIdLike()));
        criteria.setCouponNumberLike(this.searchString(criteria.getCouponNumberLike()));
        criteria.setFirstCustomerIdLike(this.searchString(criteria.getFirstCustomerIdLike()));
        criteria.setFirstPhoneLike(this.searchString(criteria.getFirstPhoneLike()));
        criteria.setUsefulLike(this.searchString(criteria.getUsefulLike()));
        criteria.setStateLike(this.searchString(criteria.getStateLike()));
        criteria.setUsedCustomerIdLike(this.searchString(criteria.getUsedCustomerIdLike()));
        criteria.setUsedPhoneLike(this.searchString(criteria.getUsedPhoneLike()));
        criteria.setCashierNameLike(this.searchString(criteria.getCashierNameLike()));
        criteria.setDeliveryStateLike(this.searchString(criteria.getDeliveryStateLike()));
        criteria.setTypeLike(this.searchString(criteria.getTypeLike()));
        criteria.setOrderNumberLike(this.searchString(criteria.getOrderNumberLike()));
        criteria.setAddressLike(this.searchString(criteria.getAddressLike()));
        criteria.setLogisticalLike(this.searchString(criteria.getLogisticalLike()));
        criteria.setCurrentCustomerIdLike(this.searchString(criteria.getCurrentCustomerIdLike()));
        criteria.setCurrentPhoneLike(this.searchString(criteria.getCurrentPhoneLike()));
        criteria.setCurrentNameLike(this.searchString(criteria.getCurrentNameLike()));
        criteria.setCurrentCustomerUidLike(this.searchString(criteria.getCurrentCustomerUidLike()));
        if (criteria.getRecordId() != null) {
            buf.append("    AND RECORD_ID = " + criteria.getRecordId());
        }

        if (criteria.getGoodsCouponEquals() != null) {
            buf.append("    AND GOODSCOUPON = '" + criteria.getGoodsCouponEquals() + "'");
        }

        if (criteria.getGoodsCouponNotEquals() != null) {
            buf.append("    AND GOODSCOUPON != '" + criteria.getGoodsCouponNotEquals() + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getGoodsUIDEquals())) {
            buf.append("    AND GOODSUID = '" + this.cut(criteria.getGoodsUIDEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getGoodsUIDNotEquals())) {
            buf.append("    AND GOODSUID != '" + this.cut(criteria.getGoodsUIDNotEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getGoodsUIDLike())) {
            buf.append("    AND GOODSUID LIKE '" + this.cut(criteria.getGoodsUIDLike()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getNameEquals())) {
            buf.append("    AND NAME = '" + this.cut(criteria.getNameEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getNameNotEquals())) {
            buf.append("    AND NAME != '" + this.cut(criteria.getNameNotEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getNameLike())) {
            buf.append("    AND NAME LIKE '" + this.cut(criteria.getNameLike()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getGoodsIdEquals())) {
            buf.append("    AND GOODSID = '" + this.cut(criteria.getGoodsIdEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getGoodsIdNotEquals())) {
            buf.append("    AND GOODSID != '" + this.cut(criteria.getGoodsIdNotEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getGoodsIdLike())) {
            buf.append("    AND GOODSID LIKE '" + this.cut(criteria.getGoodsIdLike()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getCouponNumberEquals())) {
            buf.append("    AND COUPONNUMBER = '" + this.cut(criteria.getCouponNumberEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getCouponNumberNotEquals())) {
            buf.append("    AND COUPONNUMBER != '" + this.cut(criteria.getCouponNumberNotEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getCouponNumberLike())) {
            buf.append("    AND COUPONNUMBER LIKE '" + this.cut(criteria.getCouponNumberLike()) + "'");
        }

        if (criteria.getCreateTimeUpper() != null) {
            buf.append("    AND CREATETIME <= " + criteria.getCreateTimeUpper());
        }

        if (criteria.getCreateTimeLower() != null) {
            buf.append("    AND CREATETIME >= " + criteria.getCreateTimeLower());
        }

        if (criteria.getCreateTimeEquals() != null) {
            buf.append("    AND CREATETIME = '" + criteria.getCreateTimeEquals() + "'");
        }

        if (criteria.getCreateTimeNotEquals() != null) {
            buf.append("    AND CREATETIME != '" + criteria.getCreateTimeNotEquals() + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getFirstCustomerIdEquals())) {
            buf.append("    AND FIRSTCUSTOMERID = '" + this.cut(criteria.getFirstCustomerIdEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getFirstCustomerIdNotEquals())) {
            buf.append("    AND FIRSTCUSTOMERID != '" + this.cut(criteria.getFirstCustomerIdNotEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getFirstCustomerIdLike())) {
            buf.append("    AND FIRSTCUSTOMERID LIKE '" + this.cut(criteria.getFirstCustomerIdLike()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getFirstPhoneEquals())) {
            buf.append("    AND FIRSTPHONE = '" + this.cut(criteria.getFirstPhoneEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getFirstPhoneNotEquals())) {
            buf.append("    AND FIRSTPHONE != '" + this.cut(criteria.getFirstPhoneNotEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getFirstPhoneLike())) {
            buf.append("    AND FIRSTPHONE LIKE '" + this.cut(criteria.getFirstPhoneLike()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getUsefulEquals())) {
            buf.append("    AND USEFUL = '" + this.cut(criteria.getUsefulEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getUsefulNotEquals())) {
            buf.append("    AND USEFUL != '" + this.cut(criteria.getUsefulNotEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getUsefulLike())) {
            buf.append("    AND USEFUL LIKE '" + this.cut(criteria.getUsefulLike()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getStateEquals())) {
            buf.append("    AND STATE = '" + this.cut(criteria.getStateEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getStateNotEquals())) {
            buf.append("    AND STATE != '" + this.cut(criteria.getStateNotEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getStateLike())) {
            buf.append("    AND STATE LIKE '" + this.cut(criteria.getStateLike()) + "'");
        }

        if (criteria.getUsedTimeUpper() != null) {
            buf.append("    AND USEDTIME <= " + criteria.getUsedTimeUpper());
        }

        if (criteria.getUsedTimeLower() != null) {
            buf.append("    AND USEDTIME >= " + criteria.getUsedTimeLower());
        }

        if (criteria.getUsedTimeEquals() != null) {
            buf.append("    AND USEDTIME = '" + criteria.getUsedTimeEquals() + "'");
        }

        if (criteria.getUsedTimeNotEquals() != null) {
            buf.append("    AND USEDTIME != '" + criteria.getUsedTimeNotEquals() + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getUsedCustomerIdEquals())) {
            buf.append("    AND USEDCUSTOMERID = '" + this.cut(criteria.getUsedCustomerIdEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getUsedCustomerIdNotEquals())) {
            buf.append("    AND USEDCUSTOMERID != '" + this.cut(criteria.getUsedCustomerIdNotEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getUsedCustomerIdLike())) {
            buf.append("    AND USEDCUSTOMERID LIKE '" + this.cut(criteria.getUsedCustomerIdLike()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getUsedPhoneEquals())) {
            buf.append("    AND USEDPHONE = '" + this.cut(criteria.getUsedPhoneEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getUsedPhoneNotEquals())) {
            buf.append("    AND USEDPHONE != '" + this.cut(criteria.getUsedPhoneNotEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getUsedPhoneLike())) {
            buf.append("    AND USEDPHONE LIKE '" + this.cut(criteria.getUsedPhoneLike()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getCashierNameEquals())) {
            buf.append("    AND CASHIERNAME = '" + this.cut(criteria.getCashierNameEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getCashierNameNotEquals())) {
            buf.append("    AND CASHIERNAME != '" + this.cut(criteria.getCashierNameNotEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getCashierNameLike())) {
            buf.append("    AND CASHIERNAME LIKE '" + this.cut(criteria.getCashierNameLike()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getDeliveryStateEquals())) {
            buf.append("    AND DELIVERYSTATE = '" + this.cut(criteria.getDeliveryStateEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getDeliveryStateNotEquals())) {
            buf.append("    AND DELIVERYSTATE != '" + this.cut(criteria.getDeliveryStateNotEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getDeliveryStateLike())) {
            buf.append("    AND DELIVERYSTATE LIKE '" + this.cut(criteria.getDeliveryStateLike()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getTypeEquals())) {
            buf.append("    AND TYPE = '" + this.cut(criteria.getTypeEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getTypeNotEquals())) {
            buf.append("    AND TYPE != '" + this.cut(criteria.getTypeNotEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getTypeLike())) {
            buf.append("    AND TYPE LIKE '" + this.cut(criteria.getTypeLike()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getOrderNumberEquals())) {
            buf.append("    AND ORDERNUMBER = '" + this.cut(criteria.getOrderNumberEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getOrderNumberNotEquals())) {
            buf.append("    AND ORDERNUMBER != '" + this.cut(criteria.getOrderNumberNotEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getOrderNumberLike())) {
            buf.append("    AND ORDERNUMBER LIKE '" + this.cut(criteria.getOrderNumberLike()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getAddressEquals())) {
            buf.append("    AND ADDRESS = '" + this.cut(criteria.getAddressEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getAddressNotEquals())) {
            buf.append("    AND ADDRESS != '" + this.cut(criteria.getAddressNotEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getAddressLike())) {
            buf.append("    AND ADDRESS LIKE '" + this.cut(criteria.getAddressLike()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getLogisticalEquals())) {
            buf.append("    AND LOGISTICAL = '" + this.cut(criteria.getLogisticalEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getLogisticalNotEquals())) {
            buf.append("    AND LOGISTICAL != '" + this.cut(criteria.getLogisticalNotEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getLogisticalLike())) {
            buf.append("    AND LOGISTICAL LIKE '" + this.cut(criteria.getLogisticalLike()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getCurrentCustomerIdEquals())) {
            buf.append("    AND CURRENTCUSTOMERID = '" + this.cut(criteria.getCurrentCustomerIdEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getCurrentCustomerIdNotEquals())) {
            buf.append("    AND CURRENTCUSTOMERID != '" + this.cut(criteria.getCurrentCustomerIdNotEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getCurrentCustomerIdLike())) {
            buf.append("    AND CURRENTCUSTOMERID LIKE '" + this.cut(criteria.getCurrentCustomerIdLike()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getCurrentPhoneEquals())) {
            buf.append("    AND CURRENTPHONE = '" + this.cut(criteria.getCurrentPhoneEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getCurrentPhoneNotEquals())) {
            buf.append("    AND CURRENTPHONE != '" + this.cut(criteria.getCurrentPhoneNotEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getCurrentPhoneLike())) {
            buf.append("    AND CURRENTPHONE LIKE '" + this.cut(criteria.getCurrentPhoneLike()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getCurrentNameEquals())) {
            buf.append("    AND CURRENTNAME = '" + this.cut(criteria.getCurrentNameEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getCurrentNameNotEquals())) {
            buf.append("    AND CURRENTNAME != '" + this.cut(criteria.getCurrentNameNotEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getCurrentNameLike())) {
            buf.append("    AND CURRENTNAME LIKE '" + this.cut(criteria.getCurrentNameLike()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getCurrentCustomerUidEquals())) {
            buf.append("    AND CURRENTCUSTOMERUID = '" + this.cut(criteria.getCurrentCustomerUidEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getCurrentCustomerUidNotEquals())) {
            buf.append("    AND CURRENTCUSTOMERUID != '" + this.cut(criteria.getCurrentCustomerUidNotEquals()) + "'");
        }

        if (!Strings.isNullOrEmpty(criteria.getCurrentCustomerUidLike())) {
            buf.append("    AND CURRENTCUSTOMERUID LIKE '" + this.cut(criteria.getCurrentCustomerUidLike()) + "'");
        }

        if (sort != null && sort.getColumns().size() > 0) {
            buf.append(" ORDER BY ");
            sort.getColumns().forEach((c) -> {
                buf.append(c.getColumnName().toUpperCase()).append(" ").append(c.getAscending() != null && c.getAscending() ? "ASC" : "DESC").append(", ");
            });
            buf.append("RECORD_ID ASC");
        }

        return buf.toString();
    }

    public <T extends Unit> String getUpdateStatement(T source) {
        GoodsCouponListBean data = null;
        if (source instanceof GoodsCouponListFromGoodsCouponIF) {
            data = new GoodsCouponListBean();
            ((GoodsCouponListFromGoodsCouponIF)source).getGoodsCouponDataForGoodsCouponList(data);
        }

        return data == null ? null : this.getLocalUpdateStatement(data);
    }
}
